/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Util;

/**
 *
 * @author antonio
 */

import com.hp.hpl.jena.query.*;

public class ExecuteSparqlQuery {

    private Query dbpediaQuery;
    private ResultSet results;
    
    public ExecuteSparqlQuery(String query)
    {
        dbpediaQuery = QueryFactory.create(query);
    }
    
    public ResultSet connectDbpedia()
    {
        QueryExecution qexec = QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql", this.dbpediaQuery);
        try{
        
            results = qexec.execSelect();
        
        }finally{qexec.close();}
        
        return results;
    
    }
}
